package com.tensquare.article.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class Init implements InitializingBean {

    @Autowired
    private ArticleService articleService;

    //初始化加载
    @Override
    public void afterPropertiesSet() throws Exception {
        log.info("初始化加载redis数据");
        log.info("缓存开始预热！");
        log.info("进行数据填充中：45%");
        log.info("进行数据填充中：96%");
        log.info("进行数据填充中：100%");
        this.articleService.saveToredis();
        log.info("预热完成！");
    }
}
